import 'package:flame/game.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

// 注入Bloc状态管理
class FlameBlocGame<B extends BlocBase<S>, S> extends FlameGame {
  final B bloc;

  FlameBlocGame({required this.bloc});

  B getBloc() => bloc;

  // 销毁bloc
  @override
  void onRemove() {
    bloc.close();
    super.onRemove();
  }
}
